#include "pwm.h"

// PWM输出初始化函数
void PWM_Init(uint8_t GPIO,PWM_Channle chan, uint32_t freq, PWM_Bit bit_num)
{
    ledcAttachPin(GPIO, chan);
    ledcSetup(chan, freq, bit_num);
}

// 设置频率
void PWM_SetFreq(PWM_Channle chan, uint32_t freq)
{
   ledcWriteTone(chan,freq);
}

// 设置占空比
void PWM_SetDuty(PWM_Channle chan, uint32_t duty)
{
    ledcWrite(chan, duty);
}